package cn.xy.demo02;

/**
 *  userServiceimpl代理类
 */
public class UserServiceProxy implements UserService {

    private UserService userService;

    public UserService getUserService() {
        return userService;
    }

    public void add() {
        this.log("add");
        userService.add();
    }

    public void delete() {
        this.log("delete");
        userService.delete();
    }

    public void update() {
        this.log("update");
        userService.update();
    }

    public void query() {
        this.log("query");
        userService.query();
    }

    //代理类做的事情，模拟打印日志
    public void log(String msg){
        System.out.println("[INFO]:使用了"+msg+"方法");
    }

    public void setUserService(UserService userService) {
        this.userService = userService;
    }
}
